import request from '@/router/axios';
import {downloadExcel} from '@/router/axios';
import {formatCondition} from '@/util/util';
//单条查询
export const querySysTenantInfo = (params) => {
  params.head.transCode = 'querySysTenantInfo';
  return request({
    url: '/platform/sysTenantInfo/querySysTenantInfo',
    method: 'post',
    data: params
  })
}
//多条列表查询，支持条件查询
export const querySysTenantInfoListPage = (params) => {
  params.head.transCode = 'querySysTenantInfoListPage';
  return request({
    url: '/platform/sysTenantInfo/querySysTenantInfoListPage',
    method: 'post',
    data: params
  })
}
//新增单条记录
export const saveSysTenantInfo = (params) => {
  params.head.transCode = 'saveSysTenantInfo';
  return request({
    url: '/platform/sysTenantInfo/saveSysTenantInfo',
    method: 'post',
    data: params
  })
}
//新增多条记录
export const saveSysTenantInfoList = (params) => {
  params.head.transCode = 'saveSysTenantInfoList';
  return request({
    url: '/platform/sysTenantInfo/saveSysTenantInfoList',
    method: 'post',
    data: params
  })
}
//新增或修改单条记录
export const saveOrUpdateSysTenantInfo = (params) => {
  params.head.transCode = 'saveOrUpdateSysTenantInfo';
  return request({
    url: '/platform/sysTenantInfo/saveOrUpdateSysTenantInfo',
    method: 'post',
    data: params
  })
}


//新增或修改单条记录
export const saveOrUpdateSysTenantInfoList = (params) => {
  params.head.transCode = 'saveOrUpdateSysTenantInfoList';
  return request({
    url: '/platform/sysTenantInfo/saveOrUpdateSysTenantInfoList',
    method: 'post',
    data: params
  })
}

//修改单条记录
export const updateSysTenantInfo = (params) => {
  params.head.transCode = 'updateSysTenantInfo';
  return request({
    url: '/platform/sysTenantInfo/updateSysTenantInfo',
    method: 'post',
    data: params
  })
}
//修改单条记录
export const generateLicense = (params) => {
  params.head.transCode = 'generateLicense';
  return request({
    url: '/platform/license/generateLicense',
    method: 'post',
    data: params
  })
}
//删除单条记录 
export const deleteSysTenantInfo = (params) => {
  params.head.transCode = 'deleteSysTenantInfo';
  return request({
    url: '/platform/sysTenantInfo/deleteSysTenantInfo',
    method: 'post',
    data: params
  })
}

//删除多条记录
export const deleteSysTenantInfoList = (params) => {
  params.head.transCode = 'deleteSysTenantInfoList';
  return request({
    url: '/platform/sysTenantInfo/deleteSysTenantInfoList',
    method: 'post',
    data: params
  })
}
//导出excel
export const exportSysTenantInfoExcel = (params) => {
  downloadExcel({
    url: '/tool/sysTenantInfo/excelDownload/exportSysTenantInfoExcel',
    method: 'get',
    data: 
    {
      tenantId: params.head.tenantId,
      orders:'',
      condition: formatCondition(params.body.sqlCondition)
    }
  })
}
